<template>
	<view class="home">
		<!-- 顶部栏 -->
		<top-bar :name = "name"></top-bar>
		<scroll-view scroll-y="true" class="scroll-Y">
			<!-- 轮播图 -->
			<swiper-home :bannerList = "bannerList"></swiper-home>
			<!-- 商品栏 -->
			<hot-sell :hotSellData = "hotSellData"></hot-sell>
		</scroll-view>
	
	</view>
</template>

<script>
	import swiperHome from './childHome/swiperHome.vue'
	import hotSell from "./childHome/hotSell.vue"
	import TopBar from "./childHome/TopBar.vue"
 	
	import {getBanner,getHot} from "../../network/home.js"
	
	export default {
		data() {
			return {
				name:"hello",
				bannerList:[],
				hotSellData:[]
			}
		},
		components:{
			swiperHome,
			hotSell,
			TopBar
		},
		onLoad() {
			getBanner().then((res)=>{
				this.bannerList = res.data.result
		})
			getHot().then(res=>{
				this.hotSellData = res.data.result
			})
			this.name = getApp().globalData.nickName
		},
		activated() {
			this.name = getApp().globalData.nickName
		}
	}
</script>

<style scoped>
	.home{
		padding: 20rpx 20rpx;
		position: relative;
		height: 100vh
	}
	.scroll-Y{
		position: absolute;
		left: 20rpx;
		right: 20rpx;
		width: 95%;
		top: 125rpx;
		bottom: 0rpx;
	}
</style>
